home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / compguid / titlemgt / simple.sx < prev   
Encoding:
Text File  |  1996-05-21  |  1.4 KB  |  45 lines  |  [TEXT/ttxt]

  1. --<<<
  2. -- Filename: SIMPLE.SX
  3.  
  4. -- Purpose:
  5. --     Creates a simple title that displays the words "Hello, world" in a window
  6.  
  7. -- Other Files Required: (none)
  8.  
  9. -- Instructions to User:
  10. --     1. Open this script in ScriptX.  It will create a window, add text to it,  
  11. --        create a title container file called SIMPLE.SXT, and add the window to 
  12. --        the container.
  13. --     2. Quit ScriptX.  Open SIMPLE.SXT, the newly created title container, 
  14. --        from the operating system.  It should open up the window and display 
  15. --        the text "Hello, world"
  16.  
  17. -- Specialized Classes: (none)
  18.  
  19. -- Author: Douglas Kramer
  20.  
  21. ------------------------------------------------------------------------------
  22.  
  23. -- Create a window and show it
  24. global myWindow := new Window  boundary:(new Rect x2:400 y2:300)
  25. myWindow.y := 40
  26. show myWindow
  27.  
  28. -- Create text and add it to the window
  29. global myText := new TextPresenter target:"Hello, world" \
  30.                 boundary:(new Rect x2:200 y2:50)
  31. append myWindow myText
  32.  
  33. -- Create a title container. Notice the filename ends in .SXT 
  34. -- indicating it contains a title container.
  35. global tc := new TitleContainer dir:theScriptDir path:"SIMPLE.SXT"
  36.  
  37. -- Move the window to the title container (from the scratch title)
  38. prepend tc myWindow
  39.  
  40. -- Include the startup script, which is an anonymous function
  41. tc.startupAction := (t -> load t[1])
  42.  
  43. -- Close the title container
  44. close tc
  45.